home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Tools & Apps / Misc. Utilities / Installer 3.4 / Examples - Installer 3.4 / AppTooBigForOneFloppy.r < prev    next >
Encoding:
Text File  |  1992-09-21  |  12.2 KB  |  290 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.2 sample: demonstrates file splitting
  6.  *
  7.  *    File:        AppTooBigForOneFloppy.r -    Rez Source
  8.  *
  9.  *    by:            Jon Zap
  10.  *  updated for use with Installer 3.4 by: Rich Kubota 9/1/92
  11.  *
  12.  *    Copyright © 1991 Apple Computer, Inc.
  13.  *    All rights reserved.
  14.  *
  15.  *------------------------------------------------------------------------------
  16.  *
  17.  * Install application "TheProgram" into the folder "Root":Installed Application.
  18.  * It demonstrates both Easy and Custom Installation.  For the Easy Installation
  19.  * it checks the amount of target system memory and will not do the installation
  20.  * if there is less than 1mb.  There are two source floppies, each containing
  21.  * part of the application that is too large to fit on a single floppy.  The second
  22.  * floppy has a file that contains a number of resources that the application needs.
  23.  * each of these resources is moved into the app via an 'inra' resource.
  24.  * This relies on the fact that file atoms are installed before resource atoms.
  25.  * You cannot set the tgtRequired flag in the 'inra' resources because the installer
  26.  * will check before it installs any files.
  27.  *----------------------------------------------------------------------------*/
  28.  
  29. #include "Types.r"                    /* for the ICON resource */
  30. #include "InstallerTypes.r"
  31.  
  32. /* You can build the script with the following lines:
  33. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  34. # or set up folders with the same names and contents as the floppies
  35. # put these folders in the same folder as the script or at the root directory of same disk
  36.  
  37.     rez -o "AppTooBigForOneFloppy" -t 'bbkr' -c 'bbkr' "AppTooBigForOneFloppy.r"
  38.     setfile -a i "AppTooBigForOneFloppy"        #mark Inited
  39.     scriptcheck -p "AppTooBigForOneFloppy"
  40. */
  41.  
  42. /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
  43. #define kScriptCheckSetsDate    0x01
  44. #define kMinMemMB                01    /* memory needed to install (UPDATE Error Message if changed!)*/
  45.  
  46. /* Definitions for the rules */
  47. #define rlCheckMemSize            1000
  48. #define rlOutputMemSizeError    1001
  49.  
  50. /* Definitions for the file spec atoms (specifications for source and destination files) */
  51. #define fsSourceProgram            2000
  52. #define fsTargetProgram            2001
  53. #define fsSourceProgRes1        2002
  54.  
  55. /* These are the names of the source disks */
  56. #define ProgramDisk1 "Program Disk 1:"
  57. #define ProgramDisk2 "Program Disk 2:"
  58.  
  59. /* where we want to install our file. */
  60. #define TargetPath    ":Installed Application:"
  61.  
  62. /* Definition for the package.  */
  63. #define pkTheProgram            3000
  64.  
  65. /* Definition for the file atom */
  66. #define faProgram                4000
  67.  
  68. /* Definitions for the resource atoms */
  69. #define raProgramRes1            5000
  70. #define raProgramRes2            5001
  71. #define raProgramRes3            5002
  72. #define raProgramRes4            5003
  73.  
  74. /* Definition for the package comment resource */
  75. #define cmtTheProgram            6000
  76.  
  77. /* September 1, 1992 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert     */
  78. /* this value to a LongInt seconds value needed by the Installer. */
  79. #define currentReleaseDate        9011992        
  80. #define currentVersion            101            /* Version 1.0.1 goes in the 'icmt' rsrc */
  81.  
  82. #define iconTheProgram            5100
  83.  
  84. /************************** Easy Install Rule resources **********************************/
  85. resource 'infr' (1) {
  86.     format0  {{
  87.         pickFirst,    {rlCheckMemSize, rlOutputMemSizeError}, /* Select only one of these rules */
  88.     }};
  89. };
  90.  
  91. resource 'inrl' (rlCheckMemSize) {
  92.     format0 {{
  93.         /* If the system has at least kMinMemMB megs of memory, then add the package */
  94.         checkMinMemory {kMinMemMB},
  95.         addUserDescription {"Click the Install button to install\n"}, /* message to appear in Easy Install screen */
  96.         addUserDescription {"• The Program\n"},    
  97.         addPackages {{pkTheProgram}},            /* we're installing the program */
  98.     }};
  99. };
  100.  
  101. resource 'inrl' (rlOutputMemSizeError) {
  102.     format0 {{
  103.         /* This error message will be displayed on the Easy Install screen if this rule */
  104.         /* fires.  It fires if the first rule in this pickFirst group does not fire */
  105.         reportSysError {"To do installation you need:\n\n"},
  106.         reportSysError {"• At least 1 megabyte of memory\n"}
  107.     }};
  108. };
  109.  
  110. /***************************** Package Resources ************************************************/
  111. resource 'inpk' (pkTheProgram) {
  112.     format0 {
  113.         showsOnCustom,                 /* Package appears in the Custom Install display */
  114.         removable,                    /* Package can be removed */
  115.         dontForceRestart,            /* installing an app doesn't require rebooting */
  116.         cmtTheProgram,                 /* package's 'icmt' resource id */
  117.         0,                            /* Package size (filled in by ScriptCheck) */
  118.         "TheProgram", {                /* package name for package that shows on custom */
  119.             'infa', faProgram;
  120.             'inra', raProgramRes1;
  121.             'inra', raProgramRes2;
  122.             'inra', raProgramRes3;
  123.             'inra', raProgramRes4;
  124.         }
  125.     }
  126. };
  127.  
  128. /***************************** Comments ************************************************/
  129. resource 'icmt' (cmtTheProgram) {
  130.     currentReleaseDate,
  131.     currentVersion,
  132.     iconTheProgram,
  133.     "This package contains TheProgram."
  134. };
  135.  
  136. resource 'ICON' (iconTheProgram) {
  137.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  138.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  139.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  140.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  141.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  142.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  143.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  144.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  145. };
  146.  
  147.  
  148. /********************************************* File Specs ***************************************************/
  149. /* Source File Specs */
  150. resource 'infs' (fsSourceProgram) {
  151.     'APPL',                                /* File Type */
  152.     'Arfz',                                /* Creator */
  153.     kScriptCheckSetsDate,                /* ScriptCheck will fill in the creation date */
  154.     noSearchForFile,                    /* Do not search the source disk for the file */
  155.     typeCrMustMatch,                    /* The file type and creator on source disk must match */
  156.     ProgramDisk1"TheProgram"            /* Path to the file */
  157. };
  158.  
  159. resource 'infs' (fsSourceProgRes1) {
  160.     'rsrc',                                /* File Type */
  161.     'Arfz',                                /* Creator */
  162.     kScriptCheckSetsDate,                /* ScriptCheck tool will fill in the creation date */
  163.     noSearchForFile,                    /* Do not search the source disk for the file */
  164.     typeCrMustMatch,                    /* The file type and creator on source disk must match */
  165.     ProgramDisk2"TheProgramResources"    /* Path to the file */
  166. };
  167.  
  168. /* Target File Specs */
  169. resource 'infs' (fsTargetProgram) {
  170.     'APPL',                                /* File Type */
  171.     'Arfz',                                /* Creator */
  172.     0,                                    /* not needed for target file specs */
  173.     noSearchForFile,                    /* Do not search the target disk for the file */
  174.     typeCrMustMatch,                    /* not needed for target file specs */
  175.     TargetPath"TheProgram"                /* destination Path */
  176. };
  177.  
  178. /******************************************** File Atoms ************************************************/
  179. resource 'infa' (faProgram) {
  180.     format0 {
  181.         deleteWhenRemoving,                /* Delete the file if remove (option-custom) is clicked    */
  182.         dontDeleteWhenInstalling,         /* don't need to predelete the target before copying new one */
  183.         copy,                             /* Copy the file to the destination */
  184.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  185.         updateExisting,                 /* replace an existing copy, if mine is newer */
  186.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  187.         rsrcFork, dataFork,                /* Copy both forks of the file */
  188.         fsTargetProgram,                /* TARGET file spec for this file */
  189.         fsSourceProgram,                 /* SOURCE file spec for this file */
  190.         0,                                /* atom size (filled in by ScriptCheck) */
  191.         ""                                /* Atom Description (for a file Installer will use file name) */
  192.     };
  193. };
  194.  
  195. /********************************** Resource Atoms **************************************************/
  196. resource 'inra' (raProgramRes1) {
  197.     format0 {
  198.         dontDeleteWhenRemoving,            /* dont need to delete the resource if remove (option-custom) is clicked */
  199.         dontDeleteWhenInstalling,         /* don't need to predelete the target before copying new one */
  200.         copy,                             /* Copy rsrc to destination */
  201.         noTgtRequired,                     /* Target file need not already exist on dest to install */
  202.         keepExisting,                     /* don't replace the rsrc (why is it there???) */
  203.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  204.         ignoreProtection,                /* Do it even if the target rsrc is protected (flag is ignored) */
  205.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  206.         byID,                            /* Use ID to find the rsrc */
  207.         nameNeedNotMatch,                /* Resource name need not match our specification */
  208.         fsTargetProgram,                /* Target file spec to install rsrc into */
  209.         fsSourceProgRes1,                /* Source file spec where to get rsrc */
  210.         'CODE',                            /* Resource type */
  211.         17,                             /* Resource source id */
  212.         17,                                /* Resource target id */
  213.         0,                                /* atom size (filled in by ScriptCheck) */
  214.         "",                                /* Atom description */                            
  215.         ""                                /* Resource name */
  216.     };
  217. };
  218. resource 'inra' (raProgramRes2) {
  219.     format0 {
  220.         dontDeleteWhenRemoving,            /* dont need to delete the resource if remove (option-custom) is clicked */
  221.         dontDeleteWhenInstalling,         /* don't need to predelete the target before copying new one */
  222.         copy,                             /* Copy rsrc to destination */
  223.         noTgtRequired,                     /* Target file need not already exist on dest to install */
  224.         keepExisting,                     /* don't replace the rsrc (why is it there???) */
  225.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  226.         ignoreProtection,                /* Do it even if the target rsrc is protected (flag is ignored) */
  227.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  228.         byID,                            /* Use ID to find the rsrc */
  229.         nameNeedNotMatch,                /* Resource name need not match our specification */
  230.         fsTargetProgram,                /* Target file spec to install rsrc into */
  231.         fsSourceProgRes1,                /* Source file spec where to get rsrc */
  232.         'CODE',                            /* Resource type */
  233.         16,                             /* Resource source id */
  234.         16,                                /* Resource target id */
  235.         0,                                /* atom size (filled in by ScriptCheck) */
  236.         "",                                /* Atom description */                            
  237.         ""                                /* Resource name */
  238.     };
  239. };
  240.  
  241. resource 'inra' (raProgramRes3) {
  242.     format0 {
  243.         dontDeleteWhenRemoving,            /* dont need to delete the resource if remove (option-custom) is clicked */
  244.         dontDeleteWhenInstalling,         /* don't need to predelete the target before copying new one */
  245.         copy,                             /* Copy rsrc to destination */
  246.         noTgtRequired,                     /* Target file need not already exist on dest to install */
  247.         keepExisting,                     /* don't replace the rsrc (why is it there???) */
  248.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  249.         ignoreProtection,                /* Do it even if the target rsrc is protected (flag is ignored) */
  250.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  251.         byID,                            /* Use ID to find the rsrc */
  252.         nameNeedNotMatch,                /* Resource name need not match our specification */
  253.         fsTargetProgram,                /* Target file spec to install rsrc into */
  254.         fsSourceProgRes1,                /* Source file spec where to get rsrc */
  255.         'CODE',                            /* Resource type */
  256.         9,                                 /* Resource source id */
  257.         9,                                /* Resource target id */
  258.         0,                                /* atom size (filled in by ScriptCheck) */
  259.         "",                                /* Atom description */                            
  260.         ""                                /* Resource name */
  261.     };
  262. };
  263.  
  264. resource 'inra' (raProgramRes4) {
  265.     format0 {
  266.         dontDeleteWhenRemoving,            /* dont need to delete the resource if remove (option-custom) is clicked */
  267.         dontDeleteWhenInstalling,         /* don't need to predelete the target before copying new one */
  268.         copy,                             /* Copy rsrc to destination */
  269.         noTgtRequired,                     /* Target file need not already exist on dest to install */
  270.         keepExisting,                     /* don't replace the rsrc (why is it there???) */
  271.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  272.         ignoreProtection,                /* Do it even if the target rsrc is protected (flag is ignored) */
  273.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  274.         byID,                            /* Use ID to find the rsrc */
  275.         nameNeedNotMatch,                /* Resource name need not match our specification */
  276.         fsTargetProgram,                /* Target file spec to install rsrc into */
  277.         fsSourceProgRes1,                /* Source file spec where to get rsrc */
  278.         'CODE',                            /* Resource type */
  279.         2,                                 /* Resource source id */
  280.         2,                                /* Resource target id */
  281.         0,                                /* atom size (filled in by ScriptCheck) */
  282.         "",                                /* Atom description */                            
  283.         ""                                /* Resource name */
  284.     };
  285. };
  286.  
  287.  
  288.  
  289.  
  290.